package vh.sphynx.net;

import java.net.Authenticator;
import java.net.PasswordAuthentication;

public class PasswordAuthenticator extends Authenticator {

	private PasswordAuthentication authentication;
	
	public PasswordAuthenticator() {
		
	}
	
	public void setAuthentication(String username, String password) {
		authentication = new PasswordAuthentication(username, password.toCharArray());
	}
	
	@Override
	protected PasswordAuthentication getPasswordAuthentication() {
		return authentication != null ? authentication : (authentication = new PasswordAuthentication("", new char[] {}) );
	}

}
